# Maintainer: Alexander Epaneshnikov <alex19ep@archlinux.org>
# Maintainer: Konstantin Gizdov <arch at kge dot pw>

_pkgname=j2cli
pkgname=python-${_pkgname}
pkgver=0.3.12b
pkgrel=8
pkgdesc="Command-line interface to Jinja2 for templating in shell scripts."
url="https://github.com/kolypto/j2cli"
license=("BSD")
arch=('any')
depends=('python' 'python-jinja' 'python-pyaml' 'python-setuptools-scm')
makedepends=('python-build' 'python-installer' 'python-wheel')
checkdepends=('python-nose' 'python-nose-fixes')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/kolypto/j2cli/archive/v${pkgver}.tar.gz"
        'version.patch')
b2sums=('08b434596021576dcecbaa8e700479c103f5d93c3d42880f8f5062fb0db78d4bd0bcc43c068e56b950a654b383a27b5aaff3b58ef22382c6fd6da8d9135ede98'
        '7d4e003c69df6329dca070e67095476a5666355ffaa1d124063abd1bf567ce630f56a86574b360b2f5e0d7bff3279b89e632991ec79551ad459fbef9a3647928')

prepare () {
	cd "${_pkgname}-${pkgver}"
    patch -Np1 -i "${srcdir}/version.patch"
}

build () {
	cd "${_pkgname}-${pkgver}"
    python -m build --wheel --no-isolation
}

check () {
	cd "${_pkgname}-${pkgver}"
	PYTHONPATH="$PWD/build/lib" nosetests
}

package () {
	cd "${_pkgname}-${pkgver}"
    python -m installer --destdir="${pkgdir}" dist/*.whl
	install -vDm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
